﻿using System;

namespace TicTacToe.Core.Statistics
{
    public sealed class GameID
    {
        readonly Guid mId;
        readonly PlayerID mPlayer1;
        readonly PlayerID mPlayer2;
        readonly DateTime mStartTime;

        public Guid Id { get { return mId; } }
        public PlayerID Player1 { get { return mPlayer1; } }
        public PlayerID Player2 { get { return mPlayer2; } }
        public DateTime StartTime { get { return mStartTime; } }

        public static implicit operator Guid(GameID gid)
        {
            return gid.Id;
        }

        internal GameID(PlayerID player1, PlayerID player2)
        {
            mId = Guid.NewGuid();
            mPlayer1 = player1;
            mPlayer2 = player2;
            mStartTime = DateTime.Now;
        }

        internal GameID(Guid id, PlayerID player1, PlayerID player2, DateTime starttime)
        {
            mId = id;
            mPlayer1 = player1;
            mPlayer2 = player2;
            mStartTime = starttime;
        }
    }
}
